"""
写操作示例
1.每次写操作都会继续上次位置往下写
2.每次写操作不会自动添加任何格式
"""

# file = open("file2.txt", "w")

# file.write("床前明月光，\n")
# file.write("疑是地上霜。\n")
# file.write("举头望明月，\n")
# file.write("低头思故乡。\n")

# data = ["Python web","爬虫","机器学习","数据分析","人工智能"]
# file.writelines(data)
#
# file.close()

# file = open("file2.txt","wb")

file = open("file2.txt","ab")

file.write("床前明月光,\n".encode())
file.write("疑是地上霜".encode())
file.close()